<html>
<head><title>Nicofarre test</title></head>
<body style="margin: 0; cursor: none">
<script src="../tma.js"></script>
<script src="mv_common.js"></script>
<script>
tma.extlibs = [ 'ext/gl-matrix.js', 'ext/mv/MajVj.js' ];
tma.onload = function () {
  var r = 1;
  var width = 1920 / r;
  var height = 1080 / r;
  var vj = new MajVj(width, height, true);
  MajVj.loadAllPlugins().then(function () {
    var stage = vj.create('frame', 'nicofarre',
                        { led: MajVj.frame.nicofarre.LED_STAGE_AND_BACK,
                          mirror: MajVj.frame.nicofarre.MIRROR_ON_LEFT,
                          frames: [
                            //{ name: 'sandbox', options: { id: '19624.0' } }
                            //{ name: 'sandbox', options: { id: '1674.0' } }
                            //{ name: 'sandbox', options: { id: '19689.0' } }
                            //{ name: 'sandbox', options: { id: '19528.0' } }
                            //{ name: 'sandbox', options: { id: '19698.3' } }
                            //{ name: 'sandbox', options: { id: '19454.0' } }
                            //{ name: 'sandbox', options: { id: '14373.1' } }

                            //{ name: 'sandbox', options: { id: '19291.0' } }
                            //{ name: 'sandbox', options: { id: '19512.0' } }
                            //{ name: 'sandbox', options: { id: '19150.0' } }
                            //{ name: 'sandbox', options: { id: '18770.0' } }
                            //{ name: 'sandbox', options: { id: '18760.0' } }
                            //{ name: 'sandbox', options: { id: '18602.4t' } }
                            { name: 'sandbox', options: { id: '17945.0' } }
                          ]});
    var wall = vj.create('frame', 'nicofarre',
                        { led: MajVj.frame.nicofarre.LED_WALL_BOTH,
                          mirror: MajVj.frame.nicofarre.MIRROR_ON_RIGHT,
                          frames: [
                            //{ name: 'sandbox', options: { id: '19674.0' } }
                            //{ name: 'sandbox', options: { id: '14282.0' } }

                            //{ name: 'sandbox', options: { id: '18451.0' } }
                            //{ name: 'sandbox', options: { id: '18981.0' } }
                            //{ name: 'sandbox', options: { id: '18873.0' } }
                            { name: 'sandbox', options: { id: '19136.0' } }
                          ]});
    var side = vj.create('frame', 'nicofarre',
                        { led: MajVj.frame.nicofarre.LED_FRONT_BOTH,
                          mirror: MajVj.frame.nicofarre.MIRROR_ON_RIGHT,
                          frames: [
                            { name: 'sandbox', options: { id: '18794.0' } }
                          ]});
    var ceil = vj.create('frame', 'nicofarre',
                        { led: MajVj.frame.nicofarre.LED_CEILING,
                          frames: [
                            //{ name: 'sandbox', options: { id: '18357.1' } }
                            //{ name: 'sandbox', options: { id: '18922.0' } }

                            { name: 'sandbox', options: { id: '18142.0' } }
                          ]});
    var fx = vj.create('effect', 'nicofarre');
    fx.setController(controller);
    var fbo = vj.screen().createFrameBuffer(width, height);
    vj.screen().setAlphaMode(false);
    vj.run(function (delta) {
      if (emulate)
        fbo.bind();
      vj.screen().fillColor(0.0, 0.0, 0.0, 1.0);
      stage.draw(delta);
      wall.draw(delta);
      side.draw(delta);
      ceil.draw(delta);
      if (emulate) {
        vj.screen().bind();
        vj.screen().fillColor(0.0, 0.0, 0.0, 1.0);
        fx.draw(delta, fbo.texture);
      }
      vj.screen().flush();
    });
    window.onresize = function () {
      vj.onresize();
      fx.onresize(vj.aspect());
    };
  }, function (e) { console.log('plugin load error: ' + e); });
};
</script>
</body>
</html>
